<style>
.chosen-container {
	width: 100%;
}
</style>
<div ng-controller="prodPublishCtl">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-lg-12">
				<div class="ibox">
					<div class="ibox-content">
						<form role="form" class="form-horizontal">
							<div class="form-group">
								<label class="col-sm-2 control-label">产品类目</label>
								<div class="col-sm-10">
									<select id="class" chosen disable-search="true"
										class="chosen-select" no-results-text="'没有找到相应条目'"
										ng-model="prodcatSel" data-placeholder-text-single="'请选择...'"
										ng-options="item.routename for item in prodcatOpt">
										<option value=""></option>
									</select>
								</div>
							</div>
						</form>
						<form role="form" class="form-horizontal">
							<button ng-if="if_publish" ng-click="reset()"
								class="btn btn-sm btn-primary" type="submit">重置</button>

							<button ng-if="if_publish" ng-disabled="myForm.$invalid"
								ng-click="submit()" class="btn btn-sm btn-primary" type="submit">提交</button>

						</form>
					</div>
				</div>
			</div>

		</div>

		<div class="row">
			<div class="col-lg-12">


				<div class="tabs-container">
					<uib-tabset> <uib-tab> <uib-tab-heading>
					基本属性</uib-tab-heading>
					<div class="panel-body">
						<form class="form-horizontal" name="myForm" novalidate>
							<div class="form-group">
								<label class="col-sm-2 control-label"><span
									style="color: red">*</span>店铺:</label>
								<div class="col-sm-10">
									<select class="form-control" ng-model="proddata.shop_id">
										<option ng-repeat="item in shopOpt" value="{{item.shop_id}}">{{item.shop_name}}</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label"><span
									style="color: red">*</span>产品名称:</label>
								<div class="col-sm-10">
									<input type="text" required ng-maxlength="80"
										class="form-control ng-pristine ng-untouched ng-valid ng-empty"
										placeholder="请输入内容" name="name" ng-model=proddata.prod_name>
									<div class="text-danger"
										ng-if="myForm.name.$dirty && myForm.name.$invalid">
										<span ng-if="myForm.name.$error.required"> 输入不能为空 </span> <span
											ng-show="myForm.name.$error.maxlength">不能超过80个字符 </span>
									</div>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">产品编码:</label>
								<div class="col-sm-10">
									<input type="text"
										class="form-control ng-pristine ng-untouched ng-valid ng-empty"
										placeholder="请输入内容" ng-model=proddata.code>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label"><span
									style="color: red">*</span>产品标题:</label>
								<div class="col-sm-10">
									<input type="text" required ng-maxlength="80"
										class="form-control ng-pristine ng-untouched ng-valid ng-empty"
										placeholder="请输入内容" name="title" ng-model=proddata.title>
									<div class="text-danger"
										ng-if="myForm.title.$dirty && myForm.title.$invalid">
										<span ng-if="myForm.title.$error.required"> 输入不能为空 </span> <span
											ng-show="myForm.title.$error.maxlength">不能超过80个字符 </span>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">品牌:</label>
								<div class="col-sm-10">
									<select class="form-control" ng-model="proddata.brand_id">
										<option ng-repeat="item in brandOpt" value="{{item.brand_id}}">{{item.name}}</option>
									</select>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">产品产地:</label>
								<div class="col-sm-10">
									<input type="text"
										class="form-control ng-pristine ng-untouched ng-valid ng-empty"
										placeholder="请输入内容" name="place" ng-model=proddata.place>

								</div>
							</div>
							<!--  data-mask="999-99-999-9999-9" -->
							<div class="form-group">
								<label class="col-sm-2 control-label"><span
									style="color: red">*</span>产品列表价:</label>
								<div class="col-sm-10">
									<input type="number" required ng-maxlength="120"
										class="form-control ng-pristine ng-untouched ng-valid ng-empty"
										placeholder="请输入内容(必须)" name="listprice"
										ng-model="proddata.list_price">
									<div class="text-danger"
										ng-if="myForm.listprice.$dirty && myForm.listprice.$invalid">
										<span ng-if="myForm.listprice.$error.required"> 输入不能为空
										</span> <span ng-show="myForm.listprice.$error.maxlength">不能超过80个字符
										</span>
									</div>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label"><span
									style="color: red">*</span>产品列表原价:</label>
								<div class="col-sm-10">
									<input type="number" required ng-maxlength="120"
										class="form-control ng-pristine ng-untouched ng-valid ng-empty"
										placeholder="请输入内容(必须)" name="listpriceori"
										ng-model="proddata.list_ori_price">
									<div class="text-danger"
										ng-if="myForm.listpriceori.$dirty && myForm.listpriceori.$invalid">
										<span ng-if="myForm.listpriceori.$error.required">
											输入不能为空 </span> <span ng-show="myForm.listpriceori.$error.maxlength">不能超过80个字符
										</span>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label"><span
									style="color: red">*</span>产品单位:</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" ng-model=proddata.unit
										placeholder="请输入单位(必须)">
								</div>
							</div>


							<div class="form-group">
								<label class="col-sm-2 control-label"><span
									style="color: red">*</span>产品主图:</label>
								<div class="col-sm-10">
									<div class="dropzone" drop-zone dzconfig="dtldzconfig"
										dzeventHandlers="dtldzevent" enctype="multipart/form-data">
										<div id="dropzone" class="fallback">
											<input name="file" type="file" multiple="" />
										</div>
									</div>
								</div>
							</div>

							<!-- 其他产品基本属性 -->
							<div class="hr-line-dashed"></div>
							<div class="form-group" ng-repeat="item in base_attr">
								<label class="col-sm-2 control-label"> <span
									ng-if="item.is_need== 'Y'" style="color: red">*</span>{{item.name}}:
								</label>
								<div class="col-sm-10">
									<div ng-switch="item.input_type">
										<div ng-switch-when="input">
											<input type="text" ng-maxlength="100"
												class="form-control ng-pristine ng-untouched ng-valid ng-empty"
												placeholder="请输入内容" ng-model="item.attr_set_value">
										</div>
										<div ng-switch-when="select-single">
											<select class="form-control" ng-model="item.attr_set_value">
												<option ng-repeat="attr in item.list"
													value="{{attr.attr_set_id}}">{{attr.value}}</option>
											</select>
										</div>
										<div ng-switch-when="select-multi">
											<label ng-repeat="attr in item.list"
												class="checkbox-inline i-checks">
												<div class="icheckbox_square-green"
													style="position: relative;">
													<input ng-change="baseattrvaluechange(item,attr)" icheck
														type="checkbox" ng-model="attr.status">
												</div>{{attr.value}}
											</label>
										</div>
									</div>
								</div>
							</div>


							<!-- 	<button ng-if="if_publish" ng-disabled="myForm.$invalid"
								ng-click="submit()" class="btn btn-sm btn-primary" type="submit">提交</button> -->
						</form>
					</div>
					</uib-tab> <uib-tab> <uib-tab-heading>销售属性</uib-tab-heading>
					<div class="panel-body">
						<form class="form-horizontal">
							<div class="form-group" ng-repeat="item in sale_attr">
								<label class="col-sm-2 control-label">{{item.name}}:</label>
								<div class="col-sm-10">
									<label ng-repeat="attr in item.list"
										class="checkbox-inline i-checks" style="padding-right: 5px;">
										<div class="icheckbox_square-green"
											style="position: relative; padding-right: 3px;">
											<input ng-change="saleattrvaluechange(item,attr)" icheck
												type="checkbox" ng-model="attr.status">
										</div> {{attr.value}}
									</label>
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<div class="col-sm-4 col-sm-offset-2">
									<button ng-click="makeSKU()" class="btn btn-sm btn-primary"
										type="submit">生成SKU</button>
								</div>
							</div>
						</form>
						<table class="table table-stripped table-bordered"
							style="width: 90%; margin: 0 auto">
							<thead>
								<tr>
									<th>属性组合</th>
									<th>货号</th>
									<th><span style="color: red">*</span>销售价格</th>
									<th><span style="color: red">*</span>库存数</th>
								</tr>
							</thead>
							<tbody>
								<tr ng-repeat="item in prodSku">
									<td><span ng-repeat="e in item.attr_set_ids">
											{{saleValueRender(e)}} </span></td>
									<td><input type="text" class="form-control"
										ng-model="item.code" placeholder="输入货号"></td>
									<td><input type="number" class="form-control"
										ng-model="item.price" placeholder="输入价格"></td>
									<td><input type="number" class="form-control"
										ng-model="item.stock" placeholder="输入库存"></td>
								</tr>
							</tbody>
						</table>

						<div style="margin-bottom: 50px"></div>

					</div>
					</uib-tab> <!-- 	
					<uib-tab> <uib-tab-heading> Discount </uib-tab-heading>
					<div class="panel-body"></div>
					</uib-tab> --> <uib-tab> <uib-tab-heading>
					产品图片 </uib-tab-heading>
					<div class="panel-body">

						<div class="table-responsive">
							<table class="table table-bordered table-stripped">
								<thead>
									<tr>
										<th>图片</th>
										<th>地址</th>
										<th>排序</th>
										<th>动作</th>
									</tr>
								</thead>
								<tbody>
									<tr ng-repeat="item in prodPics">
										<td><img style="width: 50px; height: 50px;"
											ng-src="{{project}}/api/file/imagedown.do?id={{item.pic_id}}"></td>
										<td><input type="text" class="form-control" disabled
											value="{{project}}api/file/imagedown.do?id={{item.pic_id}}"></td>
										<td><input type="text" class="form-control"
											ng-model=item.od></td>
										<td>
											<button ng-click="delpic(item)" class="btn btn-white">
												<i class="fa fa-trash"></i>
											</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<button ng-click="addPicture()" class="btn btn-sm btn-primary"
							type="submit">添加图片</button>
					</div>
					</uib-tab> </uib-tabset>
				</div>
			</div>
		</div>

	</div>
</div>


